
https://leetcode.cn/problems/evaluate-boolean-binary-tree/description/class Solution {
public:
    bool evaluateTree(TreeNode* root) {
        if(root->left ==nullptr)
            return root->val;
        int left=evaluateTree(root->left);
        int right=evaluateTree(root->right);

        return root->val==2?left|right:left&right;
        
    }
};